#include "external_memory.h"
#include "ui_external_memory.h"

ExternalMemory::ExternalMemory(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ExternalMemory)
{
    ui->setupUi(this);
    ui->widget->setAutoFillBackground(true);
    QPalette palette = ui->widget->palette();
    palette.setColor(QPalette::Background, Qt::white);
    ui->widget->setPalette(palette);

    ui->stackedWidget->setCurrentIndex(0);

    for (int i = 1; i <= 6; ++i) {
        QPushButton* button = findChild<QPushButton*>(QString("pushButton_%1").arg(i));
        if (button) {
            connect(button, &QPushButton::clicked, this, [this, i]() {
                ui->stackedWidget->setCurrentIndex(i - 1);
            });
        }
    }

    connect(ui->externMeneryReturnMenu, &QPushButton::clicked, this, &ExternalMemory::pushReturnMenu);
}

void ExternalMemory::pushReturnMenu()
{
    emit returnMenu();
}

ExternalMemory::~ExternalMemory()
{
    delete ui;
}

